home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / Instructions.as < prev    next >
Encoding:
Text File  |  2013-04-24  |  2.8 KB  |  92 lines

  1. class Instructions extends State
  2. {
  3.    var nInstructionsPage;
  4.    var sState;
  5.    var mcRef;
  6.    static var sSTATE_IDLE = "Idle";
  7.    static var sSTATE_SHOW = "ShowScreen";
  8.    function Instructions(_mcRef)
  9.    {
  10.       super(_mcRef,false);
  11.       this.nInstructionsPage = 1;
  12.       this.setState(Instructions.sSTATE_IDLE);
  13.    }
  14.    function doShow()
  15.    {
  16.       if(this.sState == Instructions.sSTATE_IDLE)
  17.       {
  18.          this.setState(Instructions.sSTATE_SHOW);
  19.          Main.getRef().doHide();
  20.          this.initPage();
  21.          this.mcRef.mcState.mcScreen.mcPanel.btnPlay1.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
  22.          this.mcRef.mcState.mcScreen.mcPanel.btnPlay1.onRelease = Delegate.create(Main.getRef(),Main.getRef().clickPlayButton);
  23.          this.mcRef.mcState.stop();
  24.       }
  25.    }
  26.    function doHide()
  27.    {
  28.       if(this.sState != Instructions.sSTATE_IDLE)
  29.       {
  30.          this.setState(Instructions.sSTATE_IDLE);
  31.          Main.getRef().doShow();
  32.       }
  33.    }
  34.    function desactivateButton(_mcButton)
  35.    {
  36.       delete _mcButton.button.onRollOver;
  37.       _mcButton.button.onRollOver = undefined;
  38.       delete _mcButton.button.onRelease;
  39.       _mcButton.button.onRelease = undefined;
  40.       _mcButton.gotoAndStop(2);
  41.    }
  42.    function activateButton(_mcButton, _onRelease)
  43.    {
  44.       _mcButton.gotoAndStop(1);
  45.       _mcButton.button.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
  46.       _mcButton.button.onRelease = Delegate.create(this,_onRelease);
  47.    }
  48.    function nextPage()
  49.    {
  50.       Controller.getRef().playClickSound();
  51.       this.nInstructionsPage = this.nInstructionsPage + 1;
  52.       this.initPage();
  53.    }
  54.    function previousPage()
  55.    {
  56.       Controller.getRef().playClickSound();
  57.       this.nInstructionsPage = this.nInstructionsPage - 1;
  58.       this.initPage();
  59.    }
  60.    function initPage()
  61.    {
  62.       if(this.nInstructionsPage == 1)
  63.       {
  64.          this.desactivateButton(this.mcRef.mcState.mcScreen.mcPanel.mcBack);
  65.          this.activateButton(this.mcRef.mcState.mcScreen.mcPanel.mcNext,this.nextPage);
  66.       }
  67.       else if(this.nInstructionsPage == 2)
  68.       {
  69.          this.activateButton(this.mcRef.mcState.mcScreen.mcPanel.mcBack,this.previousPage);
  70.          this.activateButton(this.mcRef.mcState.mcScreen.mcPanel.mcNext,this.nextPage);
  71.       }
  72.       else if(this.nInstructionsPage == 3)
  73.       {
  74.          this.activateButton(this.mcRef.mcState.mcScreen.mcPanel.mcBack,this.previousPage);
  75.          this.desactivateButton(this.mcRef.mcState.mcScreen.mcPanel.mcNext);
  76.       }
  77.       this.mcRef.mcState.mcScreen.mcPanel.mcPage.gotoAndStop(this.nInstructionsPage);
  78.    }
  79.    function doPause()
  80.    {
  81.    }
  82.    function doUnPause()
  83.    {
  84.    }
  85.    function Idle()
  86.    {
  87.    }
  88.    function ShowScreen()
  89.    {
  90.    }
  91. }
  92.